<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('publish_id')->comment('文章发布人');
            $table->tinyInteger('type')->default('1')->comment('文章类型：1、热点快讯；2、新闻资讯');
            $table->string('title')->nullable()->comment('文章标题');
            $table->string('desc')->nullable()->comment('文章描述');
            $table->tinyInteger('file_type')->nullable()->comment('文章素材：1、图片；2、视频');
            $table->text('files')->nullable()->comment('文件');
            $table->text('video')->nullable()->comment('视频文件');
            $table->string('thum_img')->nullable()->comment('视频封面/文章缩略图');
            $table->text('content')->comment('文章内容');
            $table->tinyInteger('is_hot')->default('0')->comment('文章推荐：0、否；1、是');
            $table->tinyInteger('is_top')->default('0')->comment('文章顶置：0、否；1、是');
            $table->string('relay_count')->default('0')->comment('转发数');
            $table->integer('first_relay_count')->default('0')->comment('初始转发数量');
            $table->string('fav_count')->default('0')->comment('点赞数');
            $table->string('first_fav_count')->default('0')->comment('初始点赞数');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
